﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using CQIE.TES.Model;
using Newtonsoft.Json.Linq;

namespace CQIE.TES.IDAL
{
    public interface IStudentDAL
    {
        void Test();

        //获取学生页面，接口方法有子类实现该接口方法
        /// <summary>
        /// 分页、查询
        /// </summary>
        /// <param name="pageNum">分数</param>
        /// <param name="pageSize">每一页有几行</param>
        /// <param name="search">查询关键字</param>
        /// <param name="count">查询总数</param>
        List<Student> GetStudentsPage(int pageNum, int pageSize, string search, out int count);


        [Obsolete]
        List<Student> SearchStudent(string nameSearch);

        /// <summary>
        /// 删除学生（逻辑删除改变IsFreeze的值）
        /// </summary>
        /// <param name="id">通过传入的id找到学生</param>
        bool DeleteStudent(int id);


        /// <summary>
        /// 添加（跟新）学生信息
        /// </summary>
        /// <param name="id">获取学生信息的参数</param>
        /// <param name="data">提交表单的数据</param>
        /// <returns></returns>
        void UpdateStudent([FromBody] JObject data);

        /// <summary>
        /// 重置学生密码
        /// </summary>
        /// <param name="id">指定需要重置的学生</param>
        /// <returns></returns>
        bool ResetPassWord(int id);

        /// <summary>
        /// 编辑学生
        /// </summary>
        /// <param name="id">通过id找到学生</param>
        /// <param name="data">前端返回的json格式的数据</param>
        /// <returns></returns>
        bool EditStudent(int id, string studentName, int sex, bool isFreeze, string studentNumber, string passWord, int classID);

        Student FindByID(int sid);

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        Student Login(string username, string password);

        /// <summary>
        /// 通过ID获取
        /// </summary>
        /// <param name="sid"></param>
        /// <returns></returns>
        Student Get(int sid);
    }
}
